package com.example.shopdemo.dto;

import com.example.shopdemo.entity.Shop;
import com.example.shopdemo.enums.ShopStateEnum;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

/**
 * @author ：Anitaxiaofeng
 * @description：
 * @create 2018-01-16
 **/
@Data
@NoArgsConstructor
public class ShopExecution {
    // 结果状态
    private int state;

    // 状态标识
    private String stateInfo;

    // 店铺数量
    private int count;

    // 操作的shop（增删改店铺的时候用）
    private Shop shop;

    // 获取的shop列表(查询店铺列表的时候用)
    private List<Shop> shopList;


    // 失败的构造器
    public ShopExecution(ShopStateEnum stateEnum) {
        this.state = stateEnum.getKey();
        this.stateInfo = stateEnum.getValue();
    }

    // 成功的构造器
    public ShopExecution(ShopStateEnum stateEnum, Shop shop) {
        this.state = stateEnum.getKey();
        this.stateInfo = stateEnum.getValue();
        this.shop = shop;
    }

    // 成功的构造器
    public ShopExecution(ShopStateEnum stateEnum, List<Shop> shopList) {
        this.state = stateEnum.getKey();
        this.stateInfo = stateEnum.getValue();
        this.shopList = shopList;
    }
}
